home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 5 / QRZ Ham Radio Callsign Database - Volume 5.iso / unix / src / token.c < prev    next >
C/C++ Source or Header  |  1993-11-01  |  434b  |  33 lines

  1.  
  2. /*
  3. **    token.c
  4. **
  5. **    tokenizes an input string, returning number of
  6. **    tokens found.
  7. */
  8. #include "cb.h"
  9.  
  10. tokenize(str,list,llen)
  11. char *str;
  12. char *list[];
  13. int llen;
  14. {
  15.     int i;
  16.     int count = 0;
  17.  
  18.     for (i=0;i<llen;i++)
  19.         list[i] = NULL;
  20.  
  21.     if (!strlen(str))
  22.         return(0);
  23.     
  24.     if ((list[count] = strtok(str, " ")) != NULL)
  25.     {
  26.         count++;
  27.         while ((count < llen) &&
  28.             ((list[count] = strtok(NULL," ")) != NULL))
  29.             count++;
  30.     }
  31.     return(count);
  32. }
  33.